package com.hmall.newskills;

import com.hmall.mapper.SysUserMapper;
import com.hmall.model.SysUser;
import com.hmall.util.TokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

public class Utils {

    @Autowired
    JedisPool jedisPool;

    @Autowired
    SysUserMapper userMapper;

    TokenUtil tokenUtil = new TokenUtil();

    public  String getJedisConnection(Integer userId) throws Exception {

            Jedis jedis = jedisPool.getResource();
            SysUser realUser = userMapper.selectByUserId(userId);
            jedis.set("test" + realUser.getPassword(), "test");
            jedis.close();
            return realUser.toString();
    }


}
